<?php 
/*
** 简单CMS
** cms/index.php
** By QINIAO
*/
require_once('../init.php');
require_once('../model/class.cms.php');
require_once('../model/class.cms_cates.php');
$qiCms = new qiCms($DB);
$qicmsCate = new qicmsCate($DB);


$cmsCates = $qicmsCate->getcmsCate();

if($action == '')
{
header("Location: index.php?action=list&id=1");
}

if($action == 'list')
{

$cateid = isset($_GET['id']) ? $_GET['id'] : '';
$cmss = $qiCms->getCateCms($cateid);

$title = $qicmsCate->getcmsCateName($cateid);

include "view/index.html";
}

if($action == 'view')
{
$cateid = $_GET['cid'];
$cmsid = $_GET['id'];
$cmss = $qiCms->getCateCms($cateid);
$cmsData = $qiCms->getOneCms($cmsid);

$title = $cmsData['title'];

include "view/view.html";
}
?>